package com.zide.report.controller;

import com.zide.common.core.domain.CommonResult;
import com.zide.report.service.IIndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.zide.common.core.domain.CommonResult.success;

/**
 * @author 石添
 * @date 2024/5/10 16:29
 */
@Tag(name = "首页报表数据")
@RestController
@RequestMapping("/report/index")
public class IndexController {

    @Resource
    private IIndexService indexService;

    @Operation(summary = "头部数据")
    @GetMapping("/topdata")
    public CommonResult getTopData() {
        return success(indexService.getTopData());
    }

    @Operation(summary = "近7天访问量")
    @GetMapping("/visit")
    public CommonResult visitVolume() {
        return success(indexService.indexService());
    }

    @Operation(summary = "用户访问来源")
    @GetMapping("/from")
    public CommonResult visitFrom() {
        return success(indexService.visitFrom());
    }

    @Operation(summary = "文章阅读量")
    @GetMapping("/article")
    public CommonResult articleRead() {
        return success(indexService.articleRead());
    }

}
